#include"Shm.hpp"

int main()
{
    SharedMemory shm;
    shm.Create();

    shm.Attach();

    shm.PrintAttr();

    sleep(3);

    while(true)
    {
        char c;
        shm.PopChar(&c);
        if(c=='Z') break;

        printf("sever get char:%c\n",c);

        sleep(1);
    }

    //断开连接
    shm.Detach();

    //如果一直卡在循环，根本执行不了删除
    //删除
    shm.RemoveShm();

    return 0;
}